Skip to content

Fix RFC 850 two-digit year parsing - #1951

Merged
brianquinlan merged 4 commits into
dart-lang:masterfrom
medz:fix/rfc850-two-digit-year
Aug 7, 2026
Merged

Fix RFC 850 two-digit year parsing#1951
brianquinlan merged 4 commits into
dart-lang:masterfrom
medz:fix/rfc850-two-digit-year

Conversation

@medz

@medz medz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • resolve RFC 850 two-digit years relative to the current UTC year
  • apply RFC 9110's 50-year rollover rule
  • add a regression test for the reported 2026 date
  • update the API documentation and changelog

Root cause

parseHttpDate() always added 1900 to RFC 850's two-digit year, so 26 was parsed as 1926 regardless of the current year.

Impact

RFC 850 timestamps such as those used in Retry-After headers now resolve to the correct century instead of potentially being treated as expired.

Closes #1939

Validation

  • dart format --output=none --set-exit-if-changed .
  • dart analyze --fatal-infos
  • dart test --platform vm
  • dart test --platform chrome
  • dart test --platform chrome --compiler dart2wasm

@medz
medz marked this pull request as ready for review July 10, 2026 03:00
@github-actions

Copy link
Copy Markdown

PR Health

Unused Dependencies ✔️
Package Status
http_parser ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
http_parser None 4.1.2 4.1.3-wip 4.1.3-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ✔️
File Coverage
pkgs/http_parser/lib/src/http_date.dart 💚 100 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/cupertino_http/example/example.dart
pkgs/http/example/main.dart
pkgs/http_multi_server/test/cert.dart

This check can be disabled by tagging the PR with skip-license-check.

Comment thread pkgs/http_parser/lib/src/http_date.dart
Comment thread pkgs/http_parser/CHANGELOG.md Outdated
medz and others added 2 commits July 21, 2026 12:39
@medz
medz requested a review from brianquinlan July 21, 2026 04:43
@brianquinlan

Copy link
Copy Markdown
Collaborator

Could you fix the lint so that I can merge this?

@medz

medz commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Could you fix the lint so that I can merge this?

fixed

@brianquinlan
brianquinlan merged commit 55c39c9 into dart-lang:master Aug 7, 2026
47 checks passed
@medz
medz deleted the fix/rfc850-two-digit-year branch August 9, 2026 01:31
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Aug 11, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/1fd02f7..8be851e):
  8be851e2  Mon Aug 10 13:51:08 2026 +0200  Sarah Zakarias  Bump to 9.0.9 (dart-lang/dartdoc#4278)

http (https://github.com/dart-lang/http/compare/9cb80c7..a9176ac):
  a9176ac  Mon Aug 10 13:27:26 2026 +0200  dart-ecosystem-bot[bot]  Tidy: package:http2 (dart-lang/http#1967)
  9bd9ccb  Sat Aug 8 06:31:37 2026 +0300  Ellet  chore(ok_http): migrate to jni 1.0.0 (dart-lang/http#1943)
  107e4c7  Sat Aug 8 04:54:46 2026 +0300  Yauhen Sampir  [cronet_http] Add DNS configuration options to CronetEngine.build (dart-lang/http#1945)
  55c39c9  Sat Aug 8 07:57:20 2026 +0800  Seven Du  Fix RFC 850 two-digit year parsing (dart-lang/http#1951)
  c71cb6d  Sat Aug 8 01:47:35 2026 +0200  Moritz  Add ecosystem groundskeeper workflow (dart-lang/http#1959)

test (https://github.com/dart-lang/test/compare/dd426d4..55b186d):
  55b186dd  Mon Aug 10 22:18:01 2026 +0200  Sigurd Meldgaard  Fix race conditions in Chrome coverage collection (dart-lang/test#2715)
  51463b0e  Mon Aug 10 21:59:15 2026 +0300  Yusuf İhsan Görgel  Keep the browser executable env override through a settings merge (dart-lang/test#2722)
  b87a2492  Fri Aug 7 12:07:52 2026 -0700  Jacob MacDonald  Enable asserts (dart-lang/test#2719)

tools (https://github.com/dart-lang/tools/compare/f3ec9ed..d644cda):
  d644cdab  Mon Aug 10 11:24:43 2026 +0200  Sigurd Meldgaard  [pub_semver] Parse only pure-digit prerelease/build identifiers as integers (dart-lang/tools#2489)
  df06fed9  Fri Aug 7 15:37:45 2026 -0700  Nate Bosch  Update to Dart 3.10.0 and reformat (dart-lang/tools#2502)
  aec21dae  Fri Aug 7 14:23:11 2026 -0700  Nate Bosch  [code_builder] Minor style fixes (dart-lang/tools#2501)
  1bbcc309  Fri Aug 7 13:56:38 2026 -0700  Nate Bosch  Revert "[code_builder] Add control-flow support (`#2135`)" (dart-lang/tools#2499)
  77607740  Fri Aug 7 01:59:58 2026 +0530  Aman Maurya  Fix MultiChannel inner channel type constraint documentation (dart-lang/tools#2491)
  889787a8  Thu Aug 6 12:56:22 2026 -0700  Nate Bosch  Roll to the latest package:csv (dart-lang/tools#2497)

R=bquinlan@google.com

Change-Id: I4cb9a8839c9ae21c57eca7750c81fdbd1a58a09c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/534341
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http_parser] parseHttpDate does not apply RFC 850 two-digit year rule

2 participants